<?php

(defined('_VALID_MOS') OR defined('_JEXEC')) or die;

/*
*
* Main template for JComments. Don't change it without serious reasons ;)
* Then creating new template you can copy this file to new template's dir without changes
*
*/
 class jtt_tpl_index extends JoomlaTuneTemplate
{
	function render1(){
	$app = & JFactory::getApplication();
	$templatepath = JURI::base() . 'templates/' . $app->getTemplate();
	$object_id = $this->getVar('comment-object_id');
	$object_group = $this->getVar('comment-object_group');
	// comments data is prepared in tpl_list and tpl_comments templates 
	$comments = $this->getVar('comments-list', '');
	// form data is prepared in tpl_form template.
	$form = $this->getVar('comments-form');
?>	
<div class="itemComments">
	<h3 class="itemCommentsCounter"><span><?php echo count($comments); ?></span>&nbsp;Comments</h3>
	<ul class="itemCommentsList">
		<?php foreach($comments as $comment): ?>
		<li class="even authorResponse firstItem">
			<img src="<?php echo $templatepath; ?>/src/images/user.png" alt="Sample Author" width="60">
			<div class="commentBodyContainer">
				<span class="commentDate">June 21th, 2012</span>
				<p>In hac habitasse platea dictumst. Donec eu elit orci. Duis diam mauris, dignissim a consequat eget, tincidunt eget mauris. Integer vehicula, odio sit amet elementum mattis, felis sem tincidunt tellus, quis vehicula est urna ac odio. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
				<div class="commentToolbar">
					<span class="commentLink">
					<a href="#" name="comment6" id="comment6">Comment Link</a>
					</span>
				</div>
			</div>
			<div class="clr"></div>
		</li>
		<?php endforeach; ?>
	</ul>
	<div class="itemCommentsForm">
		<h3>Leave a comment</h3>
		<form action="" method="post" id="comment-form" class="form-validate">
		<dl>
			<dt><label class="formName" for="userName">Name*</label></dt>
			<dd><input class="inputbox" type="text" name="userName" id="userName" autocomplete="off"></dd>
			<dt><label class="formEmail" for="commentEmail">Email*</label></dt>
			<dd><input class="inputbox" type="text" name="commentEmail" id="commentEmail" autocomplete="off"></dd>
			<dt><label class="formUrl" for="commentURL">website</label></dt>
			<dd><input class="inputbox" type="text" name="commentURL" id="commentURL" autocomplete="off"></dd>
			<dt><label class="formComment" for="commentText">comment*</label></dt>
			<dd><textarea rows="20" cols="10" class="inputbox" name="commentText" id="commentText"></textarea></dd>
		</dl>
		<input type="submit" class="button" id="submitCommentButton" value="Submit comment" autocomplete="off">
		<div class="clr"></div>
		<span id="formLog"></span>
		<input type="hidden" name="option" value="com_k2" autocomplete="off">
		<input type="hidden" name="view" value="item" autocomplete="off">
		<input type="hidden" name="task" value="comment" autocomplete="off">
		<input type="hidden" name="itemID" value="38" autocomplete="off">
		<input type="hidden" name="bd8f855f6aaa44b3393a938c81fde7ed" value="1" autocomplete="off">
		</form>
	</div>
</div>
<div class="itemBackToTop">
	<a class="k2Anchor" href="/joomla_40237/index.php/blog/item/38-donec-in-velit-vel-ipsum-auctor-vestibulum-iaculis-est#startOfPageId38">back to top</a>
</div>
<div class="clr"></div>
<script type="text/javascript">
<!--
var jcomments=new JComments(<?php echo $object_id;?>, '<?php echo $object_group; ?>','<?php echo $this->getVar('ajaxurl'); ?>');
//console.log(jcomments);
jcomments.setList('comments-list');
//-->
</script>
<?php }	
	function render() 
	{
		$object_id = $this->getVar('comment-object_id');
		$object_group = $this->getVar('comment-object_group');

		// comments data is prepared in tpl_list and tpl_comments templates 
		$comments = $this->getVar('comments-list', '');

		// form data is prepared in tpl_form template.
		$form = $this->getVar('comments-form');

		if ($comments != '' || $form != '' || $this->getVar('comments-anticache')) {
			// include comments css (only if we are in administor's panel)
			if ($this->getVar('comments-css', 0) == 1) {
				include_once (JCOMMENTS_HELPERS.DS.'system.php');
?>
<link href="<?php echo JCommentsSystemPluginHelper::getCSS(); ?>" rel="stylesheet" type="text/css" />
<?php
				if ($this->getVar('direction') == 'rtl') {
					$rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
					if ($rtlCSS != '') {
?>
<link href="<?php echo $rtlCSS; ?>" rel="stylesheet" type="text/css" />
<?php
					}
				}
			}

			// include JComments JavaScript initialization
?>
<script type="text/javascript">
<!--
var jcomments=new JComments(<?php echo $object_id;?>, '<?php echo $object_group; ?>','<?php echo $this->getVar('ajaxurl'); ?>');
jcomments.setList('comments-list');
//-->
</script>
<?php
			// IMPORTANT: Do not rename this div's id! Some JavaScript functions references to it!
?>
<a name="itemCommentsAnchor" id="itemCommentsAnchor"></a>
<div id="jc" class="itemComments">
<?php
			if ($this->getVar('comments-form-position', 0) == 1) {
				// Display comments form (or link to show form)
				if (isset($form)) {
					echo $form;
				}
			}
?>
<div id="comments" class="itemCommentsList"><?php echo $comments; ?></div>
<?php
			if ($this->getVar('comments-form-position', 0) == 0) {
				// Display comments form (or link to show form)
				if (isset($form)) {
					echo $form;
				}
			}
?>
<?php
			// Some magic like dynamic comments list loader (anticache) and auto go to anchor script
			$aca = (int) ($this->getVar('comments-gotocomment') == 1);
			$acp = (int) ($this->getVar('comments-anticache') == 1);
			$acf = (int) (($this->getVar('comments-form-link') == 1) && ($this->getVar('comments-form-locked', 0) == 0));

			if ($aca || $acp || $acf) {
?>
<script type="text/javascript">
<!--
jcomments.setAntiCache(<?php echo $aca;?>,<?php echo $acp;?>,<?php echo $acf;?>);
//-->
</script> 
<?php
			}
?>
</div>
<?php
		}
	}
}
?>